#ifndef BUZZER_H_
#define BUZZER_H_

#include "stm32f429xx.h"
#include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_rcc.h"
#include "stm32f4xx_hal_tim.h"
#include "stm32f4xx_hal_gpio.h"
#include "stdint.h"

#define	BUZZER_RCC_ENABLE			__HAL_RCC_GPIOF_CLK_ENABLE()
#define	BUZZER_TIMER_ENABLE			__HAL_RCC_TIM3_CLK_ENABLE()
#define	BUZZER_TIMER_IRQn			TIM3_IRQn
#define BUZZER_TIMER_IRQHandler		TIM3_IRQHandler
#define BUZZER_PIN					GPIO_PIN_8
#define BUZZER_PORT					GPIOF
#define BUZZER_TIMER				TIM3
#define BUZZER_TIMER_CH				CH1

typedef struct sBuzzer
{
	uint8_t state;
	uint16_t counter;
}sBuzzer;
sBuzzer buzzer;

enum E_Buzzer
{
	E_Buzzer_Off,
	E_Buzzer_On_once,
	E_Buzzer_On_error,
	E_Buzzer_ON_error_Pause
};

void BuzzerInit(void);
void BuzzerON_Error(void);
void BuzzerON_Once(void);
void BuzzerOff(void);

#endif
